<template>
  <view v-if="btnName" class="fixed bottom0 w100 maxw420 mg0a zIndex9">
    <view
      v-if="!showDisable"
      class="w570 h90 flex-box background-sub white radius45 fw400 fs34 ffmi ltsp4 mg15a"
      :class="[btnDisabled ? 'bgd2' : '']"
      @click="!btnDisabled && toOrder()"
    >
      {{ btnName }}
    </view>

    <view v-if="showDisable" class="w570 mg15a" :class="btnBetween ? 'betweenBox' : ''">
      <view
        v-if="btnBetween"
        class="w335 h90 flex-box radius10 fw500 fs30"
        :class="[btnDisabled ? 'bgd2' : '', btnBetween ? 'w335' : 'w570', leftClassName]"
        @click="!btnDisabled && submitLeft()"
      >
        {{ leftName }}
      </view>
      <view
        class="h90 flex-box radius10 fw500 fs30"
        :class="[btnDisabled ? 'bgd2' : '', btnBetween ? 'w335' : 'w570', className]"
        @click="!btnDisabled && submit()"
      >
        {{ btnName }}
      </view>
    </view>
  </view>
</template>

<script>
export default {
  name: 'repair-status', //状态跳转
  props: {
    order: {
      type: Object,
      default() {
        return {};
      },
    },
    className: {
      type: String,
      default: 'background-blue white',
    },
    btnName: {
      type: String,
      default: '确定',
    },
    // 是否可点击
    showDisable: {
      type: Boolean,
      default: false,
    },
    btnDisabled: {
      type: Boolean,
      default: false,
    },
    // between-box布局
    btnBetween: {
      type: Boolean,
      default: false,
    },
    leftName: {
      type: String,
      default: '',
    },
    leftClassName: {
      type: String,
      default: 'bgff bdcc color22',
    },
  },
  methods: {
    toOrder() {
      const vm = this;
      if (vm.order && vm.order.checkstatus) {
        vm.$emit('toOrder', vm.order.checkstatus);
        return;
      }
      vm.$emit('toOrder');
    },
    submit() {
      const vm = this;
      if (vm.order && vm.order.checkstatus) {
        vm.$emit('submit', vm.order.checkstatus);
        return;
      }
      vm.$emit('submit');
    },
    submitLeft() {
      const vm = this;
      if (vm.order && vm.order.checkstatus) {
        vm.$emit('submitLeft', vm.order.checkstatus);
        return;
      }
      vm.$emit('submitLeft');
    },
  },
};
</script>

<style lang="less" scoped></style>
